In [1]:
import plotly.offline as pyo

from plotly.graph_objs import *

import chart_studio.plotly as py

import pandas as pd
from pandas import DataFrame
In [2]:
pyo.offline.init_notebook_mode()
In [3]:
traces = [{'type' : 'scatter',
          'mode' : 'text',
          'x' : [1,2,3,4,5],
          'y' : [1,2,3,4,5],
          'text' : ['apples','oranges','pears','bananas','cherries'],
          'name' : 'Fruit'},
         {'type' : 'scatter',
          'mode' : 'text',
          'x' : [10,9,8,7,6],
          'y' : [10,9,8,7,6],
          'text' : ['cheddar','stilton','monterey jack','edam','wensleydale'],
          'name' : 'Cheese'}]

layout = {'title' : 'Cheese and Fruits',
         'xaxis' : {'title' : 'Who likes fruit?'},
         'yaxis' : {'title' : 'Who likes cheese?'},
         'annotations' : [{'text' : 'The perfect combination of fruit and cheese',
                          'xref' : 'x',
                          'yref' : 'y',
                          'x' : 11,
                          'y' : 1,
                          'showarrow' : False}]}
fig = Figure(data=traces, layout=layout)
pyo.iplot(fig)
In [4]:
traces = [{'type' : 'scatter',
          'mode' : 'text',
          'x' : [1,2,3,4,5],
          'y' : [1,2,3,4,5],
          'text' : ['apples','oranges','pears','bananas','cherries'],
           #new code goes here
           'textfont' : {'color' : 'green'},
          'name' : 'Fruit'},
         {'type' : 'scatter',
          'mode' : 'text',
          'x' : [10,9,8,7,6],
          'y' : [10,9,8,7,6],
          'text' : ['cheddar','stilton','monterey jack','edam','wensleydale'],
          #new code goes here
           'textfont' : {'color' : 'yellow'},
          'name' : 'Cheese'}]

layout = {'title' : 'Cheese and Fruits',
         'xaxis' : {'title' : 'Who likes fruit?'},
         'yaxis' : {'title' : 'Who likes cheese?'},
         'annotations' : [{'text' : 'The perfect combination of fruit and cheese',
                          'xref' : 'x',
                          'yref' : 'y',
                          'x' : 11,
                          'y' : 1,
                          'showarrow' : False}]}
fig = Figure(data=traces, layout=layout)
pyo.iplot(fig)
In [5]:
traces = [{'type' : 'scatter',
          'mode' : 'text',
          'x' : [1,2,3,4,5],
          'y' : [1,2,3,4,5],
          'text' : ['apples','oranges','pears','bananas','cherries'],
           'textfont' : {'color' : 'green'},
          'name' : 'Fruit'},
         {'type' : 'scatter',
          'mode' : 'text',
          'x' : [10,9,8,7,6],
          'y' : [10,9,8,7,6],
          'text' : ['cheddar','stilton','monterey jack','edam','wensleydale'],
           'textfont' : {'color' : 'yellow'},
          'name' : 'Cheese'}]

layout = {'title' : 'Cheese and Fruits',
          #new code goes here
          'titlefont' : {'color' : 'purple'},
         'xaxis' : {'title' : 'Who likes fruit?',
                   #new code goes here
                  'titlefont' : {'color' : 'red'},
                   },
         'yaxis' : {'title' : 'Who likes cheese?',
                    #new code goes here
                  'titlefont' : {'color' : 'blue'},
                   },
         'annotations' : [{'text' : 'The perfect combination of fruit and cheese',
                          'xref' : 'x',
                          'yref' : 'y',
                          'x' : 11,
                          'y' : 1,
                          'showarrow' : False}]}
fig = Figure(data=traces, layout=layout)
pyo.iplot(fig)
In [6]:
traces = [{'type' : 'scatter',
          'mode' : 'text',
          'x' : [1,2,3,4,5],
          'y' : [1,2,3,4,5],
          'text' : ['apples','oranges','pears','bananas','cherries'],
           'textfont' : {'color' : 'green'},
          'name' : 'Fruit'},
         {'type' : 'scatter',
          'mode' : 'text',
          'x' : [10,9,8,7,6],
          'y' : [10,9,8,7,6],
          'text' : ['cheddar','stilton','monterey jack','edam','wensleydale'],
           'textfont' : {'color' : 'yellow'},
          'name' : 'Cheese'}]

layout = {'title' : 'Cheese and Fruits',
          'titlefont' : {'color' : 'purple'},
         'xaxis' : {'title' : 'Who likes fruit?',
                  'titlefont' : {'color' : 'red',},
                   #new code goes here
                   'tickfont' : {'color' : 'goldenrod'},
                   },
         'yaxis' : {'title' : 'Who likes cheese?',
                  'titlefont' : {'color' : 'blue'},
                    #new code goes here
                   'tickfont' : {'color' : 'orange'},
                   },
         'annotations' : [{'text' : 'The perfect combination of fruit and cheese',
                          'xref' : 'x',
                          'yref' : 'y',
                          'x' : 11,
                          'y' : 1,
                          'showarrow' : False}]}
fig = Figure(data=traces, layout=layout)
pyo.iplot(fig)
In [7]:
traces = [{'type' : 'scatter',
          'mode' : 'text',
          'x' : [1,2,3,4,5],
          'y' : [1,2,3,4,5],
          'text' : ['apples','oranges','pears','bananas','cherries'],
           'textfont' : {'color' : 'green'},
          'name' : 'Fruit'},
         {'type' : 'scatter',
          'mode' : 'text',
          'x' : [10,9,8,7,6],
          'y' : [10,9,8,7,6],
          'text' : ['cheddar','stilton','monterey jack','edam','wensleydale'],
           'textfont' : {'color' : 'yellow'},
          'name' : 'Cheese'}]

layout = {'title' : 'Cheese and Fruits',
          'titlefont' : {'color' : 'purple'},
         'xaxis' : {'title' : 'Who likes fruit?',
                  'titlefont' : {'color' : 'red',},
                   'tickfont' : {'color' : 'goldenrod'},
                   },
         'yaxis' : {'title' : 'Who likes cheese?',
                  'titlefont' : {'color' : 'blue'},
                   'tickfont' : {'color' : 'orange'},
                   },
         'annotations' : [{'text' : 'The perfect combination of fruit and cheese',
                           #new code goes here
                           'font' : {'color' : 'magenta'},
                          'xref' : 'x',
                          'yref' : 'y',
                          'x' : 11,
                          'y' : 1,
                          'showarrow' : False}]}
fig = Figure(data=traces, layout=layout)
pyo.iplot(fig)
In [8]:
traces = [{'type' : 'scatter',
          'mode' : 'text',
          'x' : [1,2,3,4,5],
          'y' : [1,2,3,4,5],
          'text' : ['apples','oranges','pears','bananas','cherries'],
           'textfont' : {'color' : 'green'},
          'name' : 'Fruit'},
         {'type' : 'scatter',
          'mode' : 'text',
          'x' : [10,9,8,7,6],
          'y' : [10,9,8,7,6],
          'text' : ['cheddar','stilton','monterey jack','edam','wensleydale'],
           'textfont' : {'color' : 'yellow'},
          'name' : 'Cheese'}]

layout = {'title' : 'Cheese and Fruits',
          'titlefont' : {'color' : 'purple'},
         'xaxis' : {'title' : 'Who likes fruit?',
                  'titlefont' : {'color' : 'red',},
                   'tickfont' : {'color' : 'goldenrod'},
                   },
         'yaxis' : {'title' : 'Who likes cheese?',
                  'titlefont' : {'color' : 'blue'},
                   'tickfont' : {'color' : 'orange'},
                   },
         'annotations' : [{'text' : 'The perfect combination of fruit and cheese',
                           'font' : {'color' : 'magenta'},
                          'xref' : 'x',
                          'yref' : 'y',
                          'x' : 11,
                          'y' : 1,
                          'showarrow' : False}],
         'legend' : {'font' : {'color' : 'brown'}}}
fig = Figure(data=traces, layout=layout)
pyo.iplot(fig)
In [ ]: